﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using PraxisRent.Entities;

namespace PraxisRent.Repository.Mapping
{
    public class FOTO_PERSONAMap:EntityTypeConfiguration<FOTO_PERSONA>
    {
        public FOTO_PERSONAMap()
        {
            //Primary Key
            this.HasKey(t => t.PersonaId);

            //Properties
            this.Property(t => t.PersonaId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            //Table & Column Mappings
            this.ToTable("FOTO_PERSONA");
            this.Property(t => t.PersonaId).HasColumnName("PersonaId");
            this.Property(t => t.Imagen).HasColumnName("Imagen");
            this.Property(t => t.Hash).HasColumnName("Hash");

            //Relationships
            this.HasRequired(t => t.PERSONA)
                .WithOptional(t => t.FOTO_PERSONA);
        }
    }
}
